<% for user in users -%>
    <table width="90%" border="0">
    <tr>
        <td width="30%" align="left" valign="middle">
        <%= render :partial => 'shared/userThumbImage', :object =>user%>
        <br/>
        <%= link_to "#{user.display_name}", user_path(user.login) %>
        </td>
        <td width="20%" align="right">
        <% if  @group.nil? && !current_user.nil? && current_user.is_friends_with?(user) -%>
        <% form_tag( disconnect_user_path(user), :method => :post ) do -%>
            <%= submit_tag '删除' %>
        <% end -%>
        <% end -%>
        <% if !current_user.nil? && current_user != user -%>
        <% form_tag( deliver_message_path(user.login), :method => :get ) do -%>
        <%= submit_tag '发信' %>
        <% end -%>
        <% end -%>
        <% if !current_user.nil? && !@group.nil? -%>
        <% if current_user.is_group_admin(@group) && user != current_user -%>
            <% if user.is_group_admin(@group) -%>
                <% form_tag( :action => 'degrade' ) do -%>
                <input id="user_id" name="user[id]" type="hidden" value="<%=user.id%>"/>
                <input id="group_id" name="group[id]" type="hidden" value="<%=@group.id%>"/>
                <%= submit_tag '降级' %>
                <% end -%> 
            <% else -%>
                <% form_tag( :action => 'promote_to_admin' ) do -%>
                <input id="user_id" name="user[id]" type="hidden" value="<%=user.id%>"/>
                <input id="group_id" name="group[id]" type="hidden" value="<%=@group.id%>"/>
                <%= submit_tag '提升' %>
                <% end -%>
                <% form_tag( :action => 'kick' ) do -%>
                <input id="user_id" name="user[id]" type="hidden" value="<%=user.id%>"/>
                <input id="group_id" name="group[id]" type="hidden" value="<%=@group.id%>"/>
                <%= submit_tag '踢出' %>
                <% end -%>
            <% end -%>
        <% else -%>
            &nbsp;
        <% end -%>
        <% else -%>
            &nbsp;
        <% end -%>
      
        </td>
        <td width="20%" align="right">
            <%= user.current_status %> &nbsp;
            <%= image_tag("coins.png", :align=>"absmiddle")%><%= user.scores%>点积分
        </td>
        <td width="30%" align="right">
        <% if user.community.nil? -%>
        还没定居呢
        <% else -%>
        
        <%= link_to "#{user.district.title}", district_path(user.district) %>
        
        <%= link_to "#{user.community.title}", community_path(user.community.district, user.community) %>
        <% end -%>
        </td>
    </tr>
    </table>
    <p class="itemseparator">
    </p>
<% end -%>
<% if !@users.nil? -%>
    <%= will_paginate(@users)%>
<% end -%>